package org.f0rb.core.security;


import java.util.Arrays;

/**
 * Description goes here.
 *
 * @author f0rb
 * @version 1.0.0, 2012-04-12
 */
public class SecurityContext {
    private SecurityContext() {
    }

    public boolean isPermitted(String... names) {
        concatAuthorityName(names);
        return true;
    }

    public static final String SEPARATOR = "::";

    private static String concatAuthorityName(String... names){
        return Arrays.toString(names);
        //if(names.length == 0) return "";
        //StringBuilder authorityName = new StringBuilder(names[0]);
        //for (int i = 1; i < names.length; i++) authorityName.append(SEPARATOR).append(names[i]);
        //return authorityName.toString();
    }

    public SecurityUser getSecurityUser() {
        return new SecurityUser() {};
    }

    private static class SingletonHolder {
        private static SecurityContext instance = new SecurityContext();
    }

    public static SecurityContext getInstance() {
        return SingletonHolder.instance;
    }

    public static void main(String[] args) {
        System.out.println(concatAuthorityName());
        System.out.println(concatAuthorityName("user"));
        System.out.println(concatAuthorityName("user", "delete"));
        System.out.println(concatAuthorityName("user", "delete", "20"));
    }
}
